#!/usr/bin/node

const log = console.log,
      err = console.error;

const fs = require('fs'),
      file = process.argv[2];

if(process.argv.length!==3){
  log('Command line parameter format:cmd fileName!');
  process.exit(1);
}

try{
  var buf = fs.readFileSync(file);
}catch(e){
  err(e.message);
  process.exit(2);
}

if(buf.toString('ascii',0,2)==='BM'){
  log(`width:${buf.readInt32LE(0x12)}`);
  log(`height:${buf.readInt32LE(0x16)}`);
  log(`color depth:${buf.readUInt16LE(0x1c)}`);
}
